<% layout('/layouts/default.html', {title: '编辑管理', libs:
['validate','fileupload','dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa fa-list-alt"></i> ${text(brand.isNewRecord ?
				'新增数据' : '编辑数据')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool"
					data-widget="collapse">
					<i class="fa fa-minus"></i>
				</button>
			</div>
		</div>
		<#form:form id="inputForm" model="${brand}"
		action="${ctx}/brand/save" method="post"
		class="form-horizontal">
		<div class="box-body">
			<div class="form-unit">${text('基本信息')}</div>
			<#form:hidden path="id"/>
			
			<div class="row">
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('品牌名')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="name"
							maxlength="30" class="form-control"/></div>
					</div>
				</div>
			
				<div class="col-xs-4">
						<div class="form-group">
							<label class="control-label col-sm-4">${text('商品类型')}：</label>
							<div class="col-sm-8">
								<#form:treeselect id="parent" title="${text('商品类型')}"
									path="type" labelPath="typeName" 
									checkbox="true" 
									url="${ctx}/goodsType/treeData"
									class="" allowClear="true" canSelectRoot="true" canSelectParent="true"/>							
							</div>
						</div>
				</div>
				
				<div class="col-xs-4">
					<div class="form-group">
						<label class="control-label col-sm-4" title=""> <span
							class="required hide">*</span> ${text('权重')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-8"><#form:input path="weig"
							onkeyup="this.value=this.value.replace(/[^0-9-]+/,'');"
							maxlength="20" class="form-control"/></div>
					</div>
				</div>
				
			</div>
			
			
			
			
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2" title=""> <span
							class="required hide">*</span> ${text('描述')}：<i
							class="fa icon-question hide"></i></label>
						<div class="col-sm-10"><#form:textarea path="label" rows="4"
							maxlength="300" class="form-control"/></div>
					</div>
				</div>
			</div>
			
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">${text('品牌图片上传')}：</label>
						<div class="col-sm-10">
						
							<#form:fileupload id="upload2" returnPath="true"
	filePathInputId="img"  bizKey="${brand.id}" bizType="user_upload2"
	uploadType="image" readonly="false" maxUploadNum="1" isMini="false"/>
	<#form:input name="img" class="form-control"/>
														
							</div>
					</div>
				</div>
			</div>
			
			<div class="row">
				<div class="col-xs-12">
					<div class="form-group">
						<label class="control-label col-sm-2">${text('内容图片上传')}：</label>
						<div class="col-sm-10">
						
							<#form:fileupload id="upload3" returnPath="true"
	filePathInputId="contentimg"  bizKey="${brand.id}" bizType="user_upload3"
	uploadType="image" readonly="false" maxUploadNum="1" isMini="false"/>
	<#form:input name="contentimg" class="form-control"/>
														
							</div>
					</div>
				</div>
			</div>

			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('brand:brandData:edit')){ %>
						<button type="submit" class="btn btn-sm btn-primary"
							id="btnSubmit">
							<i class="fa fa-check"></i> ${text('保 存')}
						</button>
						&nbsp; <% } %>
						<button type="button" class="btn btn-sm btn-default"
							id="btnCancel" onclick="js.closeCurrentTabPage()">
							<i class="fa fa-reply-all"></i> ${text('关 闭')}
						</button>
					</div>
				</div>
			</div>
			</#form:form>
		</div>
	</div>
	<% } %>

	<script>
		$("#inputForm").validate({
			submitHandler : function(form) {
				js.ajaxSubmitForm($(form), function(data) {
					js.showMessage(data.message);
					if (data.result == Global.TRUE) {
						js.closeCurrentTabPage(function(contentWindow) {
							contentWindow.page();
						});
					}
				}, "json");
			}
		});
	</script>